package cn.iocoder.yudao.module.scrm.controller.admin.statistics;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.scrm.controller.admin.statistics.vo.ScrmStatisticsDataReqVO;
import cn.iocoder.yudao.module.scrm.controller.admin.statistics.vo.ScrmStatisticsDataRespVO;
import cn.iocoder.yudao.module.scrm.service.statistics.ScrmStatisticsDataService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;


/**
 * @author lizhimin
 */
@Tag(name = "管理后台 - SCRM 统计数据")
@RestController
@RequestMapping("/scrm/statistics-data")
@Validated
public class ScrmStatisticsDataController {

    @Resource
    private ScrmStatisticsDataService statisticsDataService;

    @GetMapping("/get-count-by-type")
    @Operation(summary = "获得各个业务模块数量统计")
    @PreAuthorize("@ss.hasPermission('scrm:statistics-data:query')")
    public CommonResult<ScrmStatisticsDataRespVO> getCountByType(@Valid ScrmStatisticsDataReqVO dataReqVO) {
        return success(statisticsDataService.getCountByType(dataReqVO));
    }


}
